#coding: utf-8

import requests
import json

def wp_api_getallCategories(page=None, per_page=None):
    import json
    headers = {
        'accept': 'application/json',
    }
    response = requests.get('http://blog.memlee.top/wp-json/wp/v2/categories', headers=headers)
    json1 = json.loads(response.text.replace('\n', '').replace('\r', ''))
    print(json1)

    total_categories = {}
    for json in json1:
        total_categories[json['name']]= json['id']

    return total_categories





def wp_api_getallLabeles():
    import requests
    import json
    headers = {
        'accept': 'application/json',
    }

    response = requests.get('http://blog.memlee.top/wp-json/wp/v2/tags', headers=headers)

    json1 = json.loads(response.text.replace('\n', '').replace('\r', ''))
    print(json1)

    total_categories = {}
    for json in json1:
        total_categories[json['name']]= json['id']

    return total_categories





